import { createApp } from 'vue'
import { createPinia } from 'pinia'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
import './style.css'

import App from './App.vue'
import router from './router'
import { registerMicroApps, start } from 'qiankun'

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)
app.use(router)
app.use(Antd)

// 注册微应用
registerMicroApps([
  {
    name: 'master-data-app',
    entry: '//localhost:8081',
    container: '#micro-app-container',
    activeRule: '/master-data',
    props: {
      routerBase: '/master-data',
    },
  },
  {
    name: 'procurement-app',
    entry: '//localhost:8082',
    container: '#micro-app-container',
    activeRule: '/procurement',
    props: {
      routerBase: '/procurement',
    },
  },
  {
    name: 'operation-app',
    entry: '//localhost:8083',
    container: '#micro-app-container',
    activeRule: '/operation',
    props: {
      routerBase: '/operation',
    },
  },

])

// 启动 qiankun
start({
  prefetch: false,
  sandbox: {
    experimentalStyleIsolation: true,
  },
})

app.mount('#app')